#include "config.h"
#include <string.h>
#include <stdio.h>
#include "lcd.h"
_Ht1621Date Ht1621Date;

u16 Loop_displayFlash=0;
u16 FanOn_displayFlash=0;
u8 LcdOnTab[]= {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
u8 LcdOffTab[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const u8 DigitalTubeDisplayTable[]={0x77,0x12,0x5d,0x5b,0x3a,0x6b,0x6f,0x52,0x7F,0x7b,0x00};

const u8 MenuTubeDisplayTableAIF[]={0x51,0x00,0x49,0x48,0x18,0x58,0x59,0x40,0x59,0x58,0x00};		//0~9
const u8 MenuTubeDisplayTableHNCD[]={0x13,0x12,0x19,0x1B,0x1A,0x0B,0x0B,0x12,0x1B,0x1b,0x00};

const u8 MenuStringTubeDisplayTableAIF[]={
																					0x59,0x59,0x51,0x51,0x59,0x59,0x51,0x19,0x04,0x40,
																					0x11,0x11,0x51,0x51,0x51,0x59,0x58,0x59,0x58,0x44,
																					0x11,0x24,0x15,0x22,0x18,0x42,0x42,0x0C,0x08,0x08,
																					0x00
																					};		//A~Z
const u8 MenuStringTubeDisplayTableHNCD[]={
																					0x1a,0x1B,0x01,0x13,0x09,0x08,0x0B,0x1A,0x40,0x13,
																					0x24,0x01,0x52,0x12,0x13,0x18,0x1A,0x1C,0x0B,0x40,
																					0x13,0x20,0x13,0x24,0x1B,0x21,0x48,0x08,0x09,0x00,
																					0x00
																					};

void Ht1622_CS_0() { HAL_GPIO_WritePin(GPIOA, GPIO_PIN_11, GPIO_PIN_RESET);HAL_GPIO_WritePin(GPIOA, GPIO_PIN_11, GPIO_PIN_RESET);}  // CS
void Ht1622_CS_1() { HAL_GPIO_WritePin(GPIOA, GPIO_PIN_11, GPIO_PIN_SET);HAL_GPIO_WritePin(GPIOA, GPIO_PIN_11, GPIO_PIN_SET);}
void Ht1622_WR_0() { HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_RESET);HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_RESET);}  // WR
void Ht1622_WR_1() { HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_SET);HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_SET);}
void Ht1622_DO_0() { HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_RESET);HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_RESET);}  // DAT
void Ht1622_DO_1() { HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_SET);HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_SET);}

//========================================================================
// ����:  void Ht1621Wr_Data(u8 Data,u8 cnt)   
// ����: д������
// ����: DataҪд������ݣ�cntҪд�������ж���λ
// ����: ��
//========================================================================
void Ht1622Wr_Data(u8 Data,u8 cnt) 
{ 
  u8 i; 
  for (i=0;i<cnt;i++) 
   {   
     Ht1622_WR_0();
     Ht1622_WR_0();		 
     if((Data & 0x80)==0x80) {Ht1622_DO_1();Ht1622_DO_1();}  //�ж����λ��1����0
     else {Ht1622_DO_0();Ht1622_DO_0();}	
		 Ht1622_WR_1();
     Ht1622_WR_1();		 
     Data<<=1; 
   } 
} 

//========================================================================
// ����:  void Ht1621WrCmd(u8 Cmd)   
// ����: ����д������
// ����: CmdҪд�������
// ����: ��
//========================================================================
void Ht1622WrCmd(u8 Cmd) 
{ 
   Ht1622_CS_0();
   Ht1622Wr_Data(0x80,4);          //д�������־100 
   Ht1622Wr_Data(Cmd,8);           //д���������� 
   Ht1622_CS_1(); 
} 
//========================================================================
// ����:  void Ht1621WrAllData(u8 Addr,u8 *p,u8 cnt)   
// ����: ����д��һ������
// ����: Addr��ַ0~31��pҪд������飬cnt����Ԫ�ض��ٸ�
// ����: ��
//========================================================================

void Ht1622WrAllData(u8 Addr,u8 *p,u8 cnt)
{
  u8 i;
      Ht1622_CS_0();
      Ht1622Wr_Data(0xa0,3); //д�����ݱ�־101
      Ht1622Wr_Data(Addr<<2,6); //д���ַ���ݣ��ܹ��е�ַ011111��2^5=32
	  for (i=0;i<cnt;i++)
	   {
	    Ht1622Wr_Data(*p,8); //д������,32*4λ�ļĴ�����������������д��ÿ��д8��
	    p++;
	   }
     Ht1622_CS_1();
}
//========================================================================
// ����:  void Ht1621WrOneData(u8 Addr,u8 data)   
// ����: ��һ����ַдһ������
// ����: Addr��ַ0~31��data����
// ����: ��
//========================================================================

void Ht1622WrOneData(u8 Addr,u8 wdata)
{
  Ht1622_CS_0();
  Ht1622Wr_Data(0xa0,3); //д�����ݱ�־101
  Ht1622Wr_Data(Addr<<2,6); //д���ַ���ݣ��ܹ��е�ַ011111��2^5=32
  Ht1622Wr_Data(wdata,8); //д������,32*4λ�ļĴ�����������������д��ÿ��д8��
  Ht1622_CS_1(); 
}

//========================================================================
// ����:  void Ht1621_Init(void)   
// ����: LCD��ʼ��
// ����: ��
// ����: ��
//========================================================================
void Ht1622_Init(void) 
{ 
//	 delay_1ms(10);
   Ht1622WrCmd(LCD_BIAS); 	

   Ht1622WrCmd(LCD_RC256);             //ʹ���ڲ�����

   //Ht1622WrCmd(LCD_XTAL,CS0);             //ʹ���ⲿ���� 
   Ht1622WrCmd(LCD_SYSDIS); 

   Ht1622WrCmd(LCD_WDTDIS1);

   Ht1622WrCmd(LCD_SYSEN);

   Ht1622WrCmd(LCD_ON); 

} 

//========================================================================
// Description: Update screen display
// Parameter: none
//========================================================================
void DisplayMapRefresh(void)
{
//	Ht1622WrAllData(0,LcdOnTab,32);	
	Ht1622WrAllData(0,&Ht1621Date.DisplayMapTable[0],32);	
//	PrintString1("2");	
}


//========================================================================
// Description: Display P1 temp,Flashing display when placed in timer
// Parameter: display_mode(1 Display,0 Undisplay);flash_mode(1 flash,0 no flash)
//========================================================================
void Prob2TempDisplay(u8 display_mode,u8 flash_mode,const char* string_char,u16 probe_temp)
{
//	static u8 FlashBit=0;
	u8 Length=0;	
	u8 DisplayTable[10];
	u8 i=0;
	Length=strlen(string_char);
	if(Temperature.TemperatureUnits==TemperatureC)
	{
//		probe_temp=probe_temp*9/5+32;
		if(probe_temp>=32) probe_temp=(probe_temp-32)*5/9;
		else probe_temp=0;
	}
	if(display_mode) 
	{
		if(flash_mode)
		{

		}
		else 
		{
			if(Length>3)//display numble
			{
		   if(probe_temp>999) probe_temp=999;

							if(probe_temp<100){
								Ht1621Date.DisplayMap.Probe2Hundred=DigitalTubeDisplayTable[10];//����ʾ
								Ht1621Date.DisplayMap.Probe2Ten=DigitalTubeDisplayTable[probe_temp/10];
								Ht1621Date.DisplayMap.Probe2Digits=DigitalTubeDisplayTable[probe_temp%10];
						}
						else if(probe_temp<10)
						{
								Ht1621Date.DisplayMap.Probe2Hundred=DigitalTubeDisplayTable[10];//����ʾ
								Ht1621Date.DisplayMap.Probe2Ten=DigitalTubeDisplayTable[10];//����ʾ
								Ht1621Date.DisplayMap.Probe2Digits=DigitalTubeDisplayTable[probe_temp];						
						}
						else 
						{
								Ht1621Date.DisplayMap.Probe2Hundred=DigitalTubeDisplayTable[probe_temp/100];
								Ht1621Date.DisplayMap.Probe2Ten=DigitalTubeDisplayTable[probe_temp%100/10];
								Ht1621Date.DisplayMap.Probe2Digits=DigitalTubeDisplayTable[probe_temp%100%10];						
						}
		  }
			else//display char
			{
				 for(i=0;i<3;i++)
						{
								switch(*string_char)
								{
											case 'n':DisplayTable[i]=0x0e;break;
											case 'o':DisplayTable[i]=0x0F;break;
											case 'P':DisplayTable[i]=0x7c;break;
											case '-':DisplayTable[i]=0x08;break;
									default:break;
								}
								string_char++;
						}
						Ht1621Date.DisplayMap.Probe2Hundred=DisplayTable[0];
						Ht1621Date.DisplayMap.Probe2Ten=DisplayTable[1];
						Ht1621Date.DisplayMap.Probe2Digits=DisplayTable[2];
			 }

//		FlashBit=0;
		}
	}
	else
	{
					Ht1621Date.DisplayMap.Probe2Hundred=0x00;
					Ht1621Date.DisplayMap.Probe2Ten=0x00;
					Ht1621Date.DisplayMap.Probe2Digits=0x00;
	}
}


//========================================================================
// Description: Display P1 temp,Flashing display when placed in timer
// Parameter: display_mode(1 Display,0 Undisplay);flash_mode(1 flash,0 no flash)
//========================================================================
void Prob1TempDisplay(u8 display_mode,u8 flash_mode,const char* string_char,u16 probe_temp)
{
//	static u8 FlashBit=0;
	u8 Length=0;	
	u8 DisplayTable[10];
	u8 i=0;
	Length=strlen(string_char);
	if(Temperature.TemperatureUnits==TemperatureC)
	{
//		probe_temp=probe_temp*9/5+32;
		if(probe_temp>=32) probe_temp=(probe_temp-32)*5/9;
		else probe_temp=0;
	}
	if(display_mode) 
	{
		if(flash_mode)
		{

		}
		else 
		{
			if(Length>3)//display numble
			{
		   if(probe_temp>999) probe_temp=999;

							if(probe_temp<10){
								Ht1621Date.DisplayMap.Probe1Hundred=DigitalTubeDisplayTable[10];//����ʾ
								Ht1621Date.DisplayMap.Probe1Ten=DigitalTubeDisplayTable[10];//����ʾ
								Ht1621Date.DisplayMap.Probe1Digits=DigitalTubeDisplayTable[probe_temp];	
						}
						else if(probe_temp<100)
						{

								Ht1621Date.DisplayMap.Probe1Hundred=DigitalTubeDisplayTable[10];//����ʾ
								Ht1621Date.DisplayMap.Probe1Ten=DigitalTubeDisplayTable[probe_temp/10];
								Ht1621Date.DisplayMap.Probe1Digits=DigitalTubeDisplayTable[probe_temp%10];							
						}
						else 
						{
								Ht1621Date.DisplayMap.Probe1Hundred=DigitalTubeDisplayTable[probe_temp/100];
								Ht1621Date.DisplayMap.Probe1Ten=DigitalTubeDisplayTable[probe_temp%100/10];
								Ht1621Date.DisplayMap.Probe1Digits=DigitalTubeDisplayTable[probe_temp%100%10];						
						}
		  }
			else//display char
			{
				 for(i=0;i<3;i++)
						{
								switch(*string_char)
								{
											case 'n':DisplayTable[i]=0x0e;break;
											case 'o':DisplayTable[i]=0x0F;break;
											case 'P':DisplayTable[i]=0x7c;break;
											case '-':DisplayTable[i]=0x08;break;
									default:break;
								}
								string_char++;
						}
						Ht1621Date.DisplayMap.Probe1Hundred=DisplayTable[0];
						Ht1621Date.DisplayMap.Probe1Ten=DisplayTable[1];
						Ht1621Date.DisplayMap.Probe1Digits=DisplayTable[2];
			}

//		FlashBit=0;
		}
	}
	else
	{
					Ht1621Date.DisplayMap.Probe1Hundred=0x00;
					Ht1621Date.DisplayMap.Probe1Ten=0x00;
					Ht1621Date.DisplayMap.Probe1Digits=0x00;
//		FlashBit=0;
	}
}
//========================================================================
// Description: Display Actual temp,Flashing display when placed in timer
// Parameter: display_mode(1 Display,0 Undisplay);flash_mode(1 flash,0 no flash)
//========================================================================
void ActualTempDisplay(u8 display_mode,u8 flash_mode,const char* string_char,float dis_temp,u8 FlashBit,u8 *flash_stop_time,u8 displayset)
{
	u8 Length=0;
	u8 DisplayTable[10];
	u8 i=0;
	Length=strlen(string_char);
	

		if(Temperature.TemperatureUnits==TemperatureC)
		{
	//		dis_temp=dis_temp*9/5+32;
			if(displayset){
				if(dis_temp>=320) dis_temp=(dis_temp-320)*5/90;
				else dis_temp=0;
			}else{
				if(dis_temp>=32) dis_temp=(dis_temp-32)*5/9;
				else dis_temp=0;
			}
		}else{
			if(displayset){
				dis_temp=dis_temp/10;
			}
		}	
  

	if((*flash_stop_time)>0){(*flash_stop_time)--;FlashBit=1;}

	if(display_mode) 
	{
		if(flash_mode)
		{
			if(FlashBit) 	
			{
					if(Length>3)//display numble
					{
					 if(dis_temp>999) dis_temp=999;
							if(dis_temp<10){
								Ht1621Date.DisplayMap.ActualHundred=0x00;//����ʾ
								Ht1621Date.DisplayMap.ActualTen=0x00;//����ʾ
								Ht1621Date.DisplayMap.ActualDigits=DigitalTubeDisplayTable[(u16)dis_temp];	
						}
						else if(dis_temp<100)
						{
		
								Ht1621Date.DisplayMap.ActualHundred=0x00;//����ʾ
								Ht1621Date.DisplayMap.ActualTen=DigitalTubeDisplayTable[(u16)dis_temp/10];
								Ht1621Date.DisplayMap.ActualDigits=DigitalTubeDisplayTable[(u16)dis_temp%10];							
						}
						else 
						{
								Ht1621Date.DisplayMap.ActualHundred=DigitalTubeDisplayTable[(u16)dis_temp/100];
								Ht1621Date.DisplayMap.ActualTen=DigitalTubeDisplayTable[(u16)dis_temp%100/10];
								Ht1621Date.DisplayMap.ActualDigits=DigitalTubeDisplayTable[(u16)dis_temp%100%10];						
						}
				  }
					else//display char
					{
//						 for(i=0;i<3;i++)
//								{
//										switch(*string_char)
//										{
//											case '0':DisplayTable[i]=0x77;break;
//											case '1':DisplayTable[i]=0x12;break;
//											case '2':DisplayTable[i]=0x5d;break;
//											case '3':DisplayTable[i]=0x5b;break;
//											case '4':DisplayTable[i]=0x3a;break;
//											case '5':DisplayTable[i]=0x6b;break;
//											case '6':DisplayTable[i]=0x6f;break;
//											case '7':DisplayTable[i]=0x52;break;
//											case '8':DisplayTable[i]=0x7f;break;
//											case '9':DisplayTable[i]=0x7b;break;
//											case 'E':DisplayTable[i]=0x6d;break;
//											case 'r':DisplayTable[i]=0x0c;break;
//											case 'H':DisplayTable[i]=0x3e;break;
//											case 'O':DisplayTable[i]=0x77;break;
//											case 'o':DisplayTable[i]=0x0F;break;
//											case 'F':DisplayTable[i]=0x6c;break;
//											case 'I':DisplayTable[i]=0x02;break;
//											case 'L':DisplayTable[i]=0x25;break;
//											case 'S':DisplayTable[i]=0x6b;break;
//											default:break;
//										}
//										string_char++;
//								}
//								Ht1621Date.DisplayMap.ActualHundred=DisplayTable[0];
//								Ht1621Date.DisplayMap.ActualTen=DisplayTable[1];
//								Ht1621Date.DisplayMap.ActualDigits=DisplayTable[2];
					}
			}
			else 
			{
					Ht1621Date.DisplayMap.ActualHundred=0x00;
					Ht1621Date.DisplayMap.ActualTen=0x00;
					Ht1621Date.DisplayMap.ActualDigits=0x00;
			}
		}
		else 
		{
			if(Length>3)//display numble
			{
		   if(dis_temp>999) dis_temp=999;
							if(dis_temp<10){
								Ht1621Date.DisplayMap.ActualHundred=0x00;//����ʾ
								Ht1621Date.DisplayMap.ActualTen=0x00;//����ʾ
								Ht1621Date.DisplayMap.ActualDigits=DigitalTubeDisplayTable[(u16)dis_temp];	
						}
						else if(dis_temp<100)
						{
		
								Ht1621Date.DisplayMap.ActualHundred=0x00;//����ʾ
								Ht1621Date.DisplayMap.ActualTen=DigitalTubeDisplayTable[(u16)dis_temp/10];
								Ht1621Date.DisplayMap.ActualDigits=DigitalTubeDisplayTable[(u16)dis_temp%10];							
						}
						else 
						{
								Ht1621Date.DisplayMap.ActualHundred=DigitalTubeDisplayTable[(u16)dis_temp/100];
								Ht1621Date.DisplayMap.ActualTen=DigitalTubeDisplayTable[(u16)dis_temp%100/10];
								Ht1621Date.DisplayMap.ActualDigits=DigitalTubeDisplayTable[(u16)dis_temp%100%10];						
						}
		}
			else//display char
			{
//				 for(i=0;i<3;i++)
//						{
//								switch(*string_char)
//								{
//											case '0':DisplayTable[i]=0x77;break;
//											case '1':DisplayTable[i]=0x12;break;
//											case '2':DisplayTable[i]=0x5d;break;
//											case '3':DisplayTable[i]=0x5b;break;
//											case '4':DisplayTable[i]=0x3a;break;
//											case '5':DisplayTable[i]=0x6b;break;
//											case '6':DisplayTable[i]=0x6f;break;
//											case '7':DisplayTable[i]=0x52;break;
//											case '8':DisplayTable[i]=0x7f;break;
//											case '9':DisplayTable[i]=0x7b;break;
//											case 'E':DisplayTable[i]=0x6d;break;
//											case 'r':DisplayTable[i]=0x0c;break;
//											case 'H':DisplayTable[i]=0x3e;break;
//											case 'O':DisplayTable[i]=0x77;break;
//											case 'o':DisplayTable[i]=0x0F;break;
//											case 'F':DisplayTable[i]=0x6c;break;
//											case 'I':DisplayTable[i]=0x02;break;
//											case 'L':DisplayTable[i]=0x25;break;
//											case 'S':DisplayTable[i]=0x6b;break;
//								default:break;
//								}
//								string_char++;
//						}
//						Ht1621Date.DisplayMap.ActualHundred=DisplayTable[0];
//						Ht1621Date.DisplayMap.ActualTen=DisplayTable[1];
//						Ht1621Date.DisplayMap.ActualDigits=DisplayTable[2];
			}

		
		}
	}
	else
	{
					Ht1621Date.DisplayMap.ActualHundred=0x00;
					Ht1621Date.DisplayMap.ActualTen=0x00;
					Ht1621Date.DisplayMap.ActualDigits=0x00;
	}
}
//δʹ��
void FanSeepSetDisplay(u8 display_mode,u8 flash_mode,const char* string_char,u16 dis_temp,u8 FlashBit,u8 *flash_stop_time)
{
	u8 Length=0;
	u8 DisplayTable[10];
	u8 i=0;
	Length=strlen(string_char);

	if((*flash_stop_time)>0){(*flash_stop_time)--;FlashBit=1;}

	if(display_mode) 
	{
		if(flash_mode)
		{
			if(FlashBit) 	
			{
					if(Length>3)//display numble
					{
					 if(dis_temp>999) dis_temp=999;
							if(dis_temp<10){
								Ht1621Date.DisplayMap.ActualHundred=0x00;//����ʾ
								Ht1621Date.DisplayMap.ActualTen=0x00;//����ʾ
								Ht1621Date.DisplayMap.ActualDigits=DigitalTubeDisplayTable[dis_temp];	
						}
						else if(dis_temp<100)
						{
		
								Ht1621Date.DisplayMap.ActualHundred=0x00;//����ʾ
								Ht1621Date.DisplayMap.ActualTen=DigitalTubeDisplayTable[dis_temp/10];
								Ht1621Date.DisplayMap.ActualDigits=DigitalTubeDisplayTable[dis_temp%10];							
						}
						else 
						{
								Ht1621Date.DisplayMap.ActualHundred=DigitalTubeDisplayTable[dis_temp/100];
								Ht1621Date.DisplayMap.ActualTen=DigitalTubeDisplayTable[dis_temp%100/10];
								Ht1621Date.DisplayMap.ActualDigits=DigitalTubeDisplayTable[dis_temp%100%10];						
						}
				  }
					else//display char
					{
	
					}
			}
			else 
			{
					Ht1621Date.DisplayMap.ActualHundred=0x00;
					Ht1621Date.DisplayMap.ActualTen=0x00;
					Ht1621Date.DisplayMap.ActualDigits=0x00;
			}
		}
		else 
		{
			if(Length>3)//display numble
			{
		   if(dis_temp>999) dis_temp=999;
							if(dis_temp<10){
								Ht1621Date.DisplayMap.ActualHundred=0x00;//����ʾ
								Ht1621Date.DisplayMap.ActualTen=0x00;//����ʾ
								Ht1621Date.DisplayMap.ActualDigits=DigitalTubeDisplayTable[dis_temp];	
						}
						else if(dis_temp<100)
						{
		
								Ht1621Date.DisplayMap.ActualHundred=0x00;//����ʾ
								Ht1621Date.DisplayMap.ActualTen=DigitalTubeDisplayTable[dis_temp/10];
								Ht1621Date.DisplayMap.ActualDigits=DigitalTubeDisplayTable[dis_temp%10];							
						}
						else 
						{
								Ht1621Date.DisplayMap.ActualHundred=DigitalTubeDisplayTable[dis_temp/100];
								Ht1621Date.DisplayMap.ActualTen=DigitalTubeDisplayTable[dis_temp%100/10];
								Ht1621Date.DisplayMap.ActualDigits=DigitalTubeDisplayTable[dis_temp%100%10];						
						}
		}
			else//display char
			{

			}
		}
	}
	else
	{
					Ht1621Date.DisplayMap.ActualHundred=0x00;
					Ht1621Date.DisplayMap.ActualTen=0x00;
					Ht1621Date.DisplayMap.ActualDigits=0x00;
	}
}
//========================================================================
// Description: Probe1 Icon display,Flashing display when placed in timer
// Parameter: display_mode(1 Display,0 Undisplay);flash_mode(0 no flash,1 flash);
//========================================================================
void Probe1IconDisplay(u8 display_mode,u8 flash_mode)//p1
{
//	static u8 FlashBit=0;

	if(display_mode) 
	{
		if(flash_mode)
		{
//			if(DisplayFlashBit) 	
//			{
//					Ht1621Date.DisplayMap.Probe1IconBit=0x01;
////					FlashBit=0;
//			}
//			else 
//			{
//					Ht1621Date.DisplayMap.Probe1IconBit=0x00;
////					FlashBit=1;
//			}
		}
		else
		{
					Ht1621Date.DisplayMap.Probe1IconBit=0x01;
		}
	}
	else 
	{
					Ht1621Date.DisplayMap.Probe1IconBit=0x00;
	}
}

//========================================================================
// Description: Probe2 Icon display,Flashing display when placed in timer
// Parameter: display_mode(1 Display,0 Undisplay);flash_mode(0 no flash,1 flash);
//========================================================================
void Probe2IconDisplay(u8 display_mode,u8 flash_mode)
{
//	static u8 FlashBit=0;

	if(display_mode) 
	{
		if(flash_mode)
		{
//			if(DisplayFlashBit) 	
//			{
//					Ht1621Date.DisplayMap.Probe2IconBit=0x01;
////					FlashBit=0;
//			}
//			else 
//			{
//					Ht1621Date.DisplayMap.Probe2IconBit=0x00;
////					FlashBit=1;
//			}
		}
		else
		{
					Ht1621Date.DisplayMap.Probe2IconBit=0x01;
		}
	}
	else 
	{
					Ht1621Date.DisplayMap.Probe2IconBit=0x00;
	}
}
void Probe3IconDisplay(u8 display_mode,u8 flash_mode)
{
//	static u8 FlashBit=0;

	if(display_mode) 
	{
		if(flash_mode)
		{
//			if(DisplayFlashBit) 	
//			{
//					Ht1621Date.DisplayMap.Probe3IconBit=0x01;
////					FlashBit=0;
//			}
//			else 
//			{
//					Ht1621Date.DisplayMap.Probe3IconBit=0x00;
////					FlashBit=1;
//			}
		}
		else
		{
					Ht1621Date.DisplayMap.Probe3IconBit=0x01;
		}
	}
	else 
	{
					Ht1621Date.DisplayMap.Probe3IconBit=0x00;
	}
}
void Probe4IconDisplay(u8 display_mode,u8 flash_mode)
{
//	static u8 FlashBit=0;

	if(display_mode) 
	{
		if(flash_mode)
		{
//			if(DisplayFlashBit) 	
//			{
//					Ht1621Date.DisplayMap.Probe4IconBit=0x01;
////					FlashBit=0;
//			}
//			else 
//			{
//					Ht1621Date.DisplayMap.Probe4IconBit=0x00;
////					FlashBit=1;
//			}
		}
		else
		{
					Ht1621Date.DisplayMap.Probe4IconBit=0x01;
		}
	}
	else 
	{
					Ht1621Date.DisplayMap.Probe4IconBit=0x00;
	}
}
void FanIconDisplay(u8 display_mode,u8 flash_mode)
{
	if(display_mode) 
	{
		if(flash_mode)
		{
//			if(DisplayFlashBit) 	
//			{
//					Ht1621Date.DisplayMap.FanIconBit=0x01;
////					FlashBit=0;
//			}
//			else 
//			{
//					Ht1621Date.DisplayMap.FanIconBit=0x00;
////					FlashBit=1;
//			}
		}
		else
		{
					Ht1621Date.DisplayMap.FanIconBit=0x01;
		}
	}
	else 
	{
					Ht1621Date.DisplayMap.FanIconBit=0x00;
	}
}
void HotIconDisplay(u8 display_mode,u8 flash_mode)
{
	if(display_mode) 
	{
		if(flash_mode)
		{
//			if(DisplayFlashBit) 	
//			{
//					Ht1621Date.DisplayMap.HotIconBit=0x01;
////					FlashBit=0;
//			}
//			else 
//			{
//					Ht1621Date.DisplayMap.HotIconBit=0x00;
////					FlashBit=1;
//			}
		}
		else
		{
					Ht1621Date.DisplayMap.HotIconBit=0x01;
		}
	}
	else 
	{
					Ht1621Date.DisplayMap.HotIconBit=0x00;
	}
}
void MotIconDisplay(u8 display_mode,u8 flash_mode)
{
	if(display_mode) 
	{
		if(flash_mode)
		{
//			if(DisplayFlashBit) 	
//			{
//					Ht1621Date.DisplayMap.MotIconBit=0x01;
////					FlashBit=0;
//			}
//			else 
//			{
//					Ht1621Date.DisplayMap.MotIconBit=0x00;
////					FlashBit=1;
//			}
		}
		else
		{
					Ht1621Date.DisplayMap.MotIconBit=0x01;
		}
	}
	else 
	{
					Ht1621Date.DisplayMap.MotIconBit=0x00;
	}
}
//========================================================================
// Parameter: display_mode(1 Display,0 Undisplay);flash_mode(0 no flash,1 flash);
//						wifi_signal(1 first cell no display,2 second cell no display,3 third cell no display,4 fourth cell no display)
//========================================================================
void WifiLogoDisplay(u8 display_mode,u8 flash_mode,u8 FlashBit,u8 Wifi_State)
{
	if(display_mode) 
	{
		if(flash_mode)
		{
			if(FlashBit) 	
			{
					Ht1621Date.DisplayMap.WifiIcon1=0x01;
				  Ht1621Date.DisplayMap.WifiIcon2=0x01;
				  Ht1621Date.DisplayMap.WifiIcon3=0x01;
				  Ht1621Date.DisplayMap.WifiIcon4=0x01;
			}
			else 
			{
					Ht1621Date.DisplayMap.WifiIcon1=0x00;
				  Ht1621Date.DisplayMap.WifiIcon2=0x00;
				  Ht1621Date.DisplayMap.WifiIcon3=0x00;
				  Ht1621Date.DisplayMap.WifiIcon4=0x00;
			}
		}
		else
		{
				switch(Wifi_State)
			  {
				case 0: 
						Ht1621Date.DisplayMap.WifiIcon1=0x01;
						Ht1621Date.DisplayMap.WifiIcon2=0x00;
						Ht1621Date.DisplayMap.WifiIcon3=0x00;
						Ht1621Date.DisplayMap.WifiIcon4=0x00;	
					break;
				case 1: 
						Ht1621Date.DisplayMap.WifiIcon1=0x01;
						Ht1621Date.DisplayMap.WifiIcon2=0x01;
						Ht1621Date.DisplayMap.WifiIcon3=0x00;
						Ht1621Date.DisplayMap.WifiIcon4=0x00;	
					break;
				case 2: 
						Ht1621Date.DisplayMap.WifiIcon1=0x01;
						Ht1621Date.DisplayMap.WifiIcon2=0x01;
						Ht1621Date.DisplayMap.WifiIcon3=0x01;
						Ht1621Date.DisplayMap.WifiIcon4=0x00;	
					break;
				case 3: 
						Ht1621Date.DisplayMap.WifiIcon1=0x01;
						Ht1621Date.DisplayMap.WifiIcon2=0x01;
						Ht1621Date.DisplayMap.WifiIcon3=0x01;
						Ht1621Date.DisplayMap.WifiIcon4=0x01;	
					break;
				}
		}
	}
	else 
	{
					Ht1621Date.DisplayMap.WifiIcon1=0x00;
				  Ht1621Date.DisplayMap.WifiIcon2=0x00;
				  Ht1621Date.DisplayMap.WifiIcon3=0x00;
				  Ht1621Date.DisplayMap.WifiIcon4=0x00;
	}
	
}

//========================================================================
// Description: Display P1 Temp Unit logo,Flashing display when placed in timer
// Parameter: display_mode(1 Display,0 Undisplay);flash_mode(1 flash,0 no flash);tempunit(1F,0C)
//========================================================================
void Probe1TempUnitDisplay(u8 display_mode,u8 flash_mode,u8 tempunit)
{
//	static u8 FlashBit=0;

	if(display_mode) 
	{
		if(flash_mode)
		{

		}
		else 
		{
					if(tempunit)//F
					{
						Ht1621Date.DisplayMap.Probe1FUnitIconBit=0x01;
						Ht1621Date.DisplayMap.Probe1CUnitIconBit=0x00;
					}
					else//c
					{
						Ht1621Date.DisplayMap.Probe1FUnitIconBit=0x00;
						Ht1621Date.DisplayMap.Probe1CUnitIconBit=0x01;
					}
		}
	}
	else 
	{
				Ht1621Date.DisplayMap.Probe1FUnitIconBit=0x00;
				Ht1621Date.DisplayMap.Probe1CUnitIconBit=0x00;
	}
}
//========================================================================
// Description: Display P1 Temp Unit logo,Flashing display when placed in timer
// Parameter: display_mode(1 Display,0 Undisplay);flash_mode(1 flash,0 no flash);tempunit(1F,0C)
//========================================================================
void Probe2TempUnitDisplay(u8 display_mode,u8 flash_mode,u8 tempunit)
{
//	static u8 FlashBit=0;

	if(display_mode) 
	{
		if(flash_mode)
		{

		}
		else 
		{
					if(tempunit)//F
					{
						Ht1621Date.DisplayMap.Probe2FUnitIconBit=0x00;
						Ht1621Date.DisplayMap.Probe2CUnitIconBit=0x01;
					}
					else//c
					{
						Ht1621Date.DisplayMap.Probe2FUnitIconBit=0x01;
						Ht1621Date.DisplayMap.Probe2CUnitIconBit=0x00;
					}
		}
	}
	else 
	{
				Ht1621Date.DisplayMap.Probe2FUnitIconBit=0x00;
				Ht1621Date.DisplayMap.Probe2CUnitIconBit=0x00;
	}
}

//========================================================================
// Description: Display Actual Temp Unit logo,Flashing display when placed in timer
// Parameter: display_mode(1 Display,0 Undisplay);flash_mode(1 flash,0 no flash);tempunit(1F,0C)
//========================================================================
void ActualTempUnitDisplay(u8 display_mode,u8 flash_mode,u8 tempunit)
{
//	static u8 FlashBit=0;

		if(display_mode) 
		{
			if(flash_mode)
			{

			}
			else 
			{
				if(tempunit)//F
				{
							Ht1621Date.DisplayMap.ActualFUnitIconBit=0x01;
							Ht1621Date.DisplayMap.ActualCUnitIconBit=0x00;
				}
				else//c
				{
							Ht1621Date.DisplayMap.ActualFUnitIconBit=0x00;
							Ht1621Date.DisplayMap.ActualCUnitIconBit=0x01;
			}
		}
	}
	else 
	{
				Ht1621Date.DisplayMap.ActualFUnitIconBit=0x00;
				Ht1621Date.DisplayMap.ActualCUnitIconBit=0x00;
	}
}


//========================================================================
// Description: Actual Icon display,Flashing display when placed in timer δʹ��
// Parameter: display_mode(1 Display,0 Undisplay);flash_mode(0 no flash,1 flash);
//========================================================================
void AlarmIconDisplay(u8 display_mode,u8 flash_mode,u8 warning_mode)
{
//	static u8 FlashBit=0;
	if(display_mode) 
	{
		if(flash_mode)
		{

		}
		else
		{
					if(warning_mode)//witch sound
					{
						Ht1621Date.DisplayMap.AlarmIconBit=0x01;
						Ht1621Date.DisplayMap.AlarmXIconBit=0x00;
					}
					else //witch sound
					{
						Ht1621Date.DisplayMap.AlarmIconBit=0x01;
						Ht1621Date.DisplayMap.AlarmXIconBit=0x01;					
					}
		}
	}
	else 
	{
					Ht1621Date.DisplayMap.AlarmIconBit=0x00;
				  Ht1621Date.DisplayMap.AlarmXIconBit=0x00;	
	}
}
//Display_State 0 Stabilize 1 SmokeLow 2 SmokeMiddle 3 SmokeHihg δʹ��
void Smoke_stabDisplay(u8 display_mode,u8 flash_mode,u8 Display_State)
{
	if(display_mode) 
	{
		if(flash_mode)
		{
				if(DisplayFlashBit) 	
				{
			
					switch(Display_State)
					{
						case 0: 
							 Ht1621Date.DisplayMap.StabilizeIconBit=0x01;
						   Ht1621Date.DisplayMap.SmokeLowIconBit=0x00;
						   Ht1621Date.DisplayMap.SmokeMiddleIconBit=0x00;
						   Ht1621Date.DisplayMap.SmokeHihgIconBit=0x00;
							break;
						case 1: 
							 Ht1621Date.DisplayMap.StabilizeIconBit=0x00;
						   Ht1621Date.DisplayMap.SmokeLowIconBit=0x01;
						   Ht1621Date.DisplayMap.SmokeMiddleIconBit=0x00;
						   Ht1621Date.DisplayMap.SmokeHihgIconBit=0x00;
							break;
						case 2: 
							 Ht1621Date.DisplayMap.StabilizeIconBit=0x00;
						   Ht1621Date.DisplayMap.SmokeLowIconBit=0x01;
						   Ht1621Date.DisplayMap.SmokeMiddleIconBit=0x01;
						   Ht1621Date.DisplayMap.SmokeHihgIconBit=0x00;
							break;
						case 3: 
							 Ht1621Date.DisplayMap.StabilizeIconBit=0x00;
						   Ht1621Date.DisplayMap.SmokeLowIconBit=0x01;
						   Ht1621Date.DisplayMap.SmokeMiddleIconBit=0x01;
						   Ht1621Date.DisplayMap.SmokeHihgIconBit=0x01;
							break;
					}
		
				}
				else 
				{
					Ht1621Date.DisplayMap.StabilizeIconBit=0x00;
					Ht1621Date.DisplayMap.SmokeLowIconBit=0x00;
					Ht1621Date.DisplayMap.SmokeMiddleIconBit=0x00;
					Ht1621Date.DisplayMap.SmokeHihgIconBit=0x00;
				}
		}
		else
		{
					switch(Display_State)
					{
						case 0: 
							 Ht1621Date.DisplayMap.StabilizeIconBit=0x01;
						   Ht1621Date.DisplayMap.SmokeLowIconBit=0x00;
						   Ht1621Date.DisplayMap.SmokeMiddleIconBit=0x00;
						   Ht1621Date.DisplayMap.SmokeHihgIconBit=0x00;
							break;
						case 1: 
							 Ht1621Date.DisplayMap.StabilizeIconBit=0x00;
						   Ht1621Date.DisplayMap.SmokeLowIconBit=0x01;
						   Ht1621Date.DisplayMap.SmokeMiddleIconBit=0x00;
						   Ht1621Date.DisplayMap.SmokeHihgIconBit=0x00;
							break;
						case 2: 
							 Ht1621Date.DisplayMap.StabilizeIconBit=0x00;
						   Ht1621Date.DisplayMap.SmokeLowIconBit=0x01;
						   Ht1621Date.DisplayMap.SmokeMiddleIconBit=0x01;
						   Ht1621Date.DisplayMap.SmokeHihgIconBit=0x00;
							break;
						case 3: 
							 Ht1621Date.DisplayMap.StabilizeIconBit=0x00;
						   Ht1621Date.DisplayMap.SmokeLowIconBit=0x01;
						   Ht1621Date.DisplayMap.SmokeMiddleIconBit=0x01;
						   Ht1621Date.DisplayMap.SmokeHihgIconBit=0x01;
							break;
					}
		}
	}
	else 
	{
			Ht1621Date.DisplayMap.StabilizeIconBit=0x00;
			Ht1621Date.DisplayMap.SmokeLowIconBit=0x00;
			Ht1621Date.DisplayMap.SmokeMiddleIconBit=0x00;
			Ht1621Date.DisplayMap.SmokeHihgIconBit=0x00;
	}
}
//========================================================================
// Description: Cool Icon display,Flashing display when placed in timer
// Parameter: display_mode(1 Display,0 Undisplay);flash_mode(0 no flash,1 flash);
//========================================================================
void FlameIconDisplay(u8 display_mode,u8 flash_mode)
{
//	static u8 FlashBit=0;
	if(display_mode) 
	{
		if(flash_mode)
		{
			if(DisplayFlashBit) 	
			{
					Ht1621Date.DisplayMap.FlameIconBit=0x01;
//					FlashBit=0;
			}
			else 
			{
					Ht1621Date.DisplayMap.FlameIconBit=0x00;
//					FlashBit=1;
			}
		}
		else
		{
					Ht1621Date.DisplayMap.FlameIconBit=0x01;
		}
	}
	else 
	{
					Ht1621Date.DisplayMap.FlameIconBit=0x00;
	}
}

//========================================================================
// Description: Pset Icon display,Flashing display when placed in timer δʹ��
// Parameter: display_mode(1 Display,0 Undisplay);flash_mode(0 no flash,1 flash);
//========================================================================
void PsetIconDisplay(u8 display_mode,u8 flash_mode,u8 FlashBit,u8 *flash_stop_time)
{
//	if((*flash_stop_time)>0){(*flash_stop_time)--;FlashBit=1;}

//	if(display_mode) 
//	{
//		if(flash_mode)
//		{
//			if(FlashBit) 	
//			{
//					Ht1621Date.DisplayMap.PsetIconBit=0x01;
//					Ht1621Date.DisplayMap.PIconBit=0x01;
//			}
//			else 
//			{
//					Ht1621Date.DisplayMap.PsetIconBit=0x00;
//					Ht1621Date.DisplayMap.PIconBit=0x00;
//			}
//		}
//		else
//		{
//					Ht1621Date.DisplayMap.PsetIconBit=0x01;
//					Ht1621Date.DisplayMap.PIconBit=0x01;
//		}
//	}
//	else 
//	{
//					Ht1621Date.DisplayMap.PsetIconBit=0x00;
//					Ht1621Date.DisplayMap.PIconBit=0x00;
//	}
}

//========================================================================
// Description: StartUpDot Icon display,Flashing display when placed in timer
// Parameter: display_mode(1 Display,0 Undisplay);flash_mode(0 no flash,1 flash);
//========================================================================
void MenuDisplay(u8 display_mode,u8 flash_mode,const char* string_char)
{
		u8 Length=0;
		u8 DisplayTableAIF[11];
		u8 DisplayTableHNCD[11];
		u8 i=0;
		Length=strlen(string_char);

		if(display_mode) 
		{
			   if(flash_mode)
				 {

	       }else
				 {
						 for(i=0;i<11;i++)
								{
										switch(*string_char)
										{
											case 'A':DisplayTableAIF[i]=0x59;DisplayTableHNCD[i]=0x1A;break;
											case 'B':DisplayTableAIF[i]=0x59;DisplayTableHNCD[i]=0x1B;break;
											case 'C':DisplayTableAIF[i]=0x51;DisplayTableHNCD[i]=0x01;break;
											case 'D':DisplayTableAIF[i]=0x51;DisplayTableHNCD[i]=0x13;break;
											case 'E':DisplayTableAIF[i]=0x59;DisplayTableHNCD[i]=0x09;break;
											case 'F':DisplayTableAIF[i]=0x59;DisplayTableHNCD[i]=0x08;break;
											case 'G':DisplayTableAIF[i]=0x51;DisplayTableHNCD[i]=0x0B;break;
											case 'H':DisplayTableAIF[i]=0x19;DisplayTableHNCD[i]=0x1A;break;
											case 'I':DisplayTableAIF[i]=0x04;DisplayTableHNCD[i]=0x40;break;
											case 'J':DisplayTableAIF[i]=0x40;DisplayTableHNCD[i]=0x13;break;
											case 'K':DisplayTableAIF[i]=0x19;DisplayTableHNCD[i]=0x2c;break;
											case 'L':DisplayTableAIF[i]=0x11;DisplayTableHNCD[i]=0x01;break;
											case 'M':DisplayTableAIF[i]=0x51;DisplayTableHNCD[i]=0x52;break;
											case 'N':DisplayTableAIF[i]=0x51;DisplayTableHNCD[i]=0x12;break;
											case 'O':DisplayTableAIF[i]=0x51;DisplayTableHNCD[i]=0x13;break;
											case 'P':DisplayTableAIF[i]=0x59;DisplayTableHNCD[i]=0x18;break;
											case 'Q':DisplayTableAIF[i]=0x58;DisplayTableHNCD[i]=0x1A;break;
											case 'R':DisplayTableAIF[i]=0x59;DisplayTableHNCD[i]=0x1C;break;
											case 'S':DisplayTableAIF[i]=0x58;DisplayTableHNCD[i]=0x0B;break;
											case 'T':DisplayTableAIF[i]=0x44;DisplayTableHNCD[i]=0x40;break;
											case 'U':DisplayTableAIF[i]=0x11;DisplayTableHNCD[i]=0x13;break;
											case 'V':DisplayTableAIF[i]=0x24;DisplayTableHNCD[i]=0x20;break;
											case 'X':DisplayTableAIF[i]=0x22;DisplayTableHNCD[i]=0x24;break;
											case 'Y':DisplayTableAIF[i]=0x18;DisplayTableHNCD[i]=0x1B;break;
											case 'Z':DisplayTableAIF[i]=0x42;DisplayTableHNCD[i]=0x21;break;
											case 'W':DisplayTableAIF[i]=0x15;DisplayTableHNCD[i]=0x13;break;
											case '+':DisplayTableAIF[i]=0x0C;DisplayTableHNCD[i]=0x48;break;
											case '-':DisplayTableAIF[i]=0x08;DisplayTableHNCD[i]=0x08;break;
											case '=':DisplayTableAIF[i]=0x08;DisplayTableHNCD[i]=0x09;break;
											case ' ':DisplayTableAIF[i]=0x00;DisplayTableHNCD[i]=0x00;break;
											case '0':DisplayTableAIF[i]=0x51;DisplayTableHNCD[i]=0x13;break;
											case '1':DisplayTableAIF[i]=0x00;DisplayTableHNCD[i]=0x12;break;
											case '2':DisplayTableAIF[i]=0x49;DisplayTableHNCD[i]=0x19;break;
											case '3':DisplayTableAIF[i]=0x48;DisplayTableHNCD[i]=0x1b;break;
											case '4':DisplayTableAIF[i]=0x18;DisplayTableHNCD[i]=0x1a;break;
											case '5':DisplayTableAIF[i]=0x58;DisplayTableHNCD[i]=0x0b;break;
											case '6':DisplayTableAIF[i]=0x59;DisplayTableHNCD[i]=0x0b;break;
											case '7':DisplayTableAIF[i]=0x40;DisplayTableHNCD[i]=0x12;break;
											case '8':DisplayTableAIF[i]=0x59;DisplayTableHNCD[i]=0x1b;break;
											case '9':DisplayTableAIF[i]=0x58;DisplayTableHNCD[i]=0x1b;break;
											case '.':DisplayTableAIF[i]=0x58;DisplayTableHNCD[i]=0x18;break;
											case 'd':DisplayTableAIF[i]=0x09;DisplayTableHNCD[i]=0x1B;break;
											case 'o':DisplayTableAIF[i]=0x09;DisplayTableHNCD[i]=0x0B;break;
											case 'w':DisplayTableAIF[i]=0x05;DisplayTableHNCD[i]=0x03;break;
											case 'n':DisplayTableAIF[i]=0x09;DisplayTableHNCD[i]=0x0A;break;
											default:break;
										}
										string_char++;
									}
					 Ht1621Date.DisplayMap.Menu1AFG=DisplayTableAIF[0];
					 Ht1621Date.DisplayMap.Menu1BCD=DisplayTableHNCD[0];
						
					 Ht1621Date.DisplayMap.Menu2AFG=DisplayTableAIF[1];
					 Ht1621Date.DisplayMap.Menu2BCD=DisplayTableHNCD[1];		

					 Ht1621Date.DisplayMap.Menu3AFG=DisplayTableAIF[2];
					 Ht1621Date.DisplayMap.Menu3BCD=DisplayTableHNCD[2];	

					 Ht1621Date.DisplayMap.Menu4AFG=DisplayTableAIF[3];
					 Ht1621Date.DisplayMap.Menu4BCD=DisplayTableHNCD[3];

					 Ht1621Date.DisplayMap.Menu5AFG=DisplayTableAIF[4];
					 Ht1621Date.DisplayMap.Menu5BCD=DisplayTableHNCD[4];

					 Ht1621Date.DisplayMap.Menu6AFG=DisplayTableAIF[5];
					 Ht1621Date.DisplayMap.Menu6BCD=DisplayTableHNCD[5];

					 Ht1621Date.DisplayMap.Menu7AFG=DisplayTableAIF[6];
					 Ht1621Date.DisplayMap.Menu7BCD=DisplayTableHNCD[6];			

					 Ht1621Date.DisplayMap.Menu8AFG=DisplayTableAIF[7];
					 Ht1621Date.DisplayMap.Menu8BCD=DisplayTableHNCD[7];		

					 Ht1621Date.DisplayMap.Menu9AFG=DisplayTableAIF[8];
					 Ht1621Date.DisplayMap.Menu9BCD=DisplayTableHNCD[8];	
					 
					 Ht1621Date.DisplayMap.Menu10AFG=DisplayTableAIF[9];
					 Ht1621Date.DisplayMap.Menu10BCD=DisplayTableHNCD[9];	
					 
					 Ht1621Date.DisplayMap.Menu11AFG=DisplayTableAIF[10];
					 Ht1621Date.DisplayMap.Menu11BCD=DisplayTableHNCD[10];						 
				 }
	}else 
		{
					 Ht1621Date.DisplayMap.Menu1AFG=0x00;
					 Ht1621Date.DisplayMap.Menu1BCD=0x00;
						
					 Ht1621Date.DisplayMap.Menu2AFG=0x00;
					 Ht1621Date.DisplayMap.Menu2BCD=0x00;		

					 Ht1621Date.DisplayMap.Menu3AFG=0x00;
					 Ht1621Date.DisplayMap.Menu3BCD=0x00;		

					 Ht1621Date.DisplayMap.Menu4AFG=0x00;
					 Ht1621Date.DisplayMap.Menu4BCD=0x00;	

					 Ht1621Date.DisplayMap.Menu5AFG=0x00;
					 Ht1621Date.DisplayMap.Menu5BCD=0x00;

					 Ht1621Date.DisplayMap.Menu6AFG=0x00;
					 Ht1621Date.DisplayMap.Menu6BCD=0x00;	

					 Ht1621Date.DisplayMap.Menu7AFG=0x00;
					 Ht1621Date.DisplayMap.Menu7BCD=0x00;				

					 Ht1621Date.DisplayMap.Menu8AFG=0x00;
					 Ht1621Date.DisplayMap.Menu8BCD=0x00;		

					 Ht1621Date.DisplayMap.Menu9AFG=0x00;
					 Ht1621Date.DisplayMap.Menu9BCD=0x00;	
					 
					 Ht1621Date.DisplayMap.Menu10AFG=0x00;
					 Ht1621Date.DisplayMap.Menu10BCD=0x00;	
					 
					 Ht1621Date.DisplayMap.Menu11AFG=0x00;
					 Ht1621Date.DisplayMap.Menu11BCD=0x00;		
		}
}
void SleepMenuDisplay(u8 display_mode,u8 flash_mode)
{
	if(display_mode) 
	{
		Loop_displayFlash++;
		 if(flash_mode)
			{

			}
			else 
			{
					if(Loop_displayFlash<10)
					{//FOR MENU
						MenuDisplay(1,0,"PRESS FOR   ");
					}	
					else if(Loop_displayFlash<20)		//PRESS AND
					{
						MenuDisplay(1,0,"2 SECONDS   ");
					}					
					else if(Loop_displayFlash<40) 
					{
           MenuDisplay(1,0,"-----------");
					}
					else Loop_displayFlash=0;
			}
		}
		else
		{
			MenuDisplay(0,0,"FOR MENU   ");//����ʾ
		}
}
void SetTempDisplay(u8 display_mode,u16 dis_temp)
{
	if(Temperature.TemperatureUnits==TemperatureC)
	{
			if(dis_temp>=320) dis_temp=(dis_temp-320)*5/90;
			else dis_temp=0;
////		dis_temp=dis_temp*9/5+32;
//		if(dis_temp>=32) dis_temp=(dis_temp-32)*5/9;
//		else dis_temp=0;
	}
  else dis_temp=dis_temp/10;
		
	if(display_mode)
	{
	        MenuDisplay(1,0,"TARGET ");
		      if(dis_temp<10)
					{
	 				 Ht1621Date.DisplayMap.Menu8AFG=0x00;//����ʾ
					 Ht1621Date.DisplayMap.Menu8BCD=0x00;	
					 
					 Ht1621Date.DisplayMap.Menu9AFG=0x00;
					 Ht1621Date.DisplayMap.Menu9BCD=0x00;	
					 
					 Ht1621Date.DisplayMap.Menu10AFG=MenuTubeDisplayTableAIF[(u16)dis_temp];
					 Ht1621Date.DisplayMap.Menu10BCD=MenuTubeDisplayTableHNCD[(u16)dis_temp];
					}
					else if(dis_temp<100)
					{
	 				 Ht1621Date.DisplayMap.Menu8AFG=0x00;//����ʾ
					 Ht1621Date.DisplayMap.Menu8BCD=0x00;	
					 
					 Ht1621Date.DisplayMap.Menu9AFG=MenuTubeDisplayTableAIF[(u16)dis_temp/10];
					 Ht1621Date.DisplayMap.Menu9BCD=MenuTubeDisplayTableHNCD[(u16)dis_temp/10];	
					 
					 Ht1621Date.DisplayMap.Menu10AFG=MenuTubeDisplayTableAIF[(u16)dis_temp%10];
					 Ht1621Date.DisplayMap.Menu10BCD=MenuTubeDisplayTableHNCD[(u16)dis_temp%10];					
					}
					else 
					{
	 				 Ht1621Date.DisplayMap.Menu8AFG=MenuTubeDisplayTableAIF[(u16)dis_temp/100];//����ʾ
					 Ht1621Date.DisplayMap.Menu8BCD=MenuTubeDisplayTableHNCD[(u16)dis_temp/100];	
					 
					 Ht1621Date.DisplayMap.Menu9AFG=MenuTubeDisplayTableAIF[(u16)dis_temp%100/10];
					 Ht1621Date.DisplayMap.Menu9BCD=MenuTubeDisplayTableHNCD[(u16)dis_temp%100/10];	
					 
					 Ht1621Date.DisplayMap.Menu10AFG=MenuTubeDisplayTableAIF[(u16)dis_temp%100%10];
					 Ht1621Date.DisplayMap.Menu10BCD=MenuTubeDisplayTableHNCD[(u16)dis_temp%100%10];					
					}
					 Ht1621Date.DisplayMap.Menu11AFG=0x00;
					 Ht1621Date.DisplayMap.Menu11BCD=0x00;
	}
	else {
	MenuDisplay(0,0," ");
	}
}
void ShutDownDisplay(u8 display_mode,u16 time){
   if(display_mode)
	 {
	  MenuDisplay(1,0,"S down       ");
		Ht1621Date.DisplayMap.Menu8AFG=MenuTubeDisplayTableAIF[time/60];
		Ht1621Date.DisplayMap.Menu8BCD=MenuTubeDisplayTableHNCD[time/60];	
		 
		Ht1621Date.DisplayMap.Menu10AFG=MenuTubeDisplayTableAIF[time%60/10];
		Ht1621Date.DisplayMap.Menu10BCD=MenuTubeDisplayTableHNCD[time%60/10];		
		 
		Ht1621Date.DisplayMap.Menu11AFG=MenuTubeDisplayTableAIF[time%60%10];
		Ht1621Date.DisplayMap.Menu11BCD=MenuTubeDisplayTableHNCD[time%60%10];		
	 }
	 else MenuDisplay(0,0,"DOWM       ");
}
void LEFTDisplay(u8 display_mode,u16 time){
	if(display_mode)
	{
	  if(MODE==Waiting)MenuDisplay(1,0,"FEED       ");
		else MenuDisplay(1,0,"CLEAR      ");
		Ht1621Date.DisplayMap.Menu7AFG=MenuTubeDisplayTableAIF[time/60];
		Ht1621Date.DisplayMap.Menu7BCD=MenuTubeDisplayTableHNCD[time/60];	
		 
		Ht1621Date.DisplayMap.Menu9AFG=MenuTubeDisplayTableAIF[time%60/10];
		Ht1621Date.DisplayMap.Menu9BCD=MenuTubeDisplayTableHNCD[time%60/10];		
		 
		Ht1621Date.DisplayMap.Menu10AFG=MenuTubeDisplayTableAIF[time%60%10];
		Ht1621Date.DisplayMap.Menu10BCD=MenuTubeDisplayTableHNCD[time%60%10];			
	}
 else MenuDisplay(0,0,"   LEFT    ");
}
void Program_versionDisplayTEST(u8 display_mode,u16 version)
{
  if(display_mode)
	{
		  
		if(GrillModel.Type==Grill700E)
		 MenuDisplay(1,0,"700E V     ");
    else if(GrillModel.Type==Grill7002C)
		 MenuDisplay(1,0,"700-2C V   ");
		
	 	 	Ht1621Date.DisplayMap.Menu7AFG=MenuTubeDisplayTableAIF[version/100];
			Ht1621Date.DisplayMap.Menu7BCD=MenuTubeDisplayTableHNCD[version/100];	
					 
		  Ht1621Date.DisplayMap.Menu8AFG=MenuTubeDisplayTableAIF[version%100/10];
			Ht1621Date.DisplayMap.Menu8BCD=MenuTubeDisplayTableHNCD[version%100/10];	
					 
			Ht1621Date.DisplayMap.Menu9AFG=MenuTubeDisplayTableAIF[version%100%10];
		  Ht1621Date.DisplayMap.Menu9BCD=MenuTubeDisplayTableHNCD[version%100%10];
	}
	else MenuDisplay(0,0,"V           ");
}
void FanSeepDispaly(u8 display_mode,u16 Seep)//δʹ��
{
//	 if(display_mode)
//	 {
//		FanOn_displayFlash++;
//	  if(FanOn_displayFlash<50)
//		{
//			MenuDisplay(1,0,"FAN ON      ");
//			Ht1621Date.DisplayMap.Menu8AFG=MenuTubeDisplayTableAIF[Seep/100];
//			Ht1621Date.DisplayMap.Menu8BCD=MenuTubeDisplayTableHNCD[Seep/100];
//				
//			Ht1621Date.DisplayMap.Menu9AFG=MenuTubeDisplayTableAIF[Seep%100/10];
//			Ht1621Date.DisplayMap.Menu9BCD=MenuTubeDisplayTableHNCD[Seep%100/10];
//			
//			Ht1621Date.DisplayMap.Menu10AFG=MenuTubeDisplayTableAIF[Seep%100%10];
//			Ht1621Date.DisplayMap.Menu10BCD=MenuTubeDisplayTableHNCD[Seep%100%10];
//		}
//		else if(FanOn_displayFlash<60)
//     MenuDisplay(1,0,"-----------");
//		else if(FanOn_displayFlash<70)
//     MenuDisplay(1,0,"PRESS TO   ");
//		else if(FanOn_displayFlash<80)
//		 MenuDisplay(1,0,"CHANGE     ");
//		else if(FanOn_displayFlash<90)
//		MenuDisplay(1,0,"SPEED      ");
//		else if(FanOn_displayFlash<100)
//     MenuDisplay(1,0,"-----------");
//		else FanOn_displayFlash=0;
//	 }
//	 else MenuDisplay(0,0,"SPEED      ");
}
void TestTimeDisplay(u8 display_mode,u8 Test_Mode,u8 RunTime)//δʹ��
{
// if(display_mode)
// {
//  switch(Test_Mode)
//	{
//		case 0 : 
//			MenuDisplay(1,0,"AUGER ON   ");
//			Ht1621Date.DisplayMap.Menu10AFG=MenuTubeDisplayTableAIF[RunTime/10];
//			Ht1621Date.DisplayMap.Menu10BCD=MenuTubeDisplayTableHNCD[RunTime/10];
//				
//			Ht1621Date.DisplayMap.Menu11AFG=MenuTubeDisplayTableAIF[RunTime%10];
//			Ht1621Date.DisplayMap.Menu11BCD=MenuTubeDisplayTableHNCD[RunTime%10];		  
//			break;
//		case 1 : 
//			MenuDisplay(1,0,"FAN ON      ");
//			Ht1621Date.DisplayMap.Menu8AFG=MenuTubeDisplayTableAIF[RunTime/10];
//			Ht1621Date.DisplayMap.Menu8BCD=MenuTubeDisplayTableHNCD[RunTime/10];
//				
//			Ht1621Date.DisplayMap.Menu9AFG=MenuTubeDisplayTableAIF[RunTime%10];
//			Ht1621Date.DisplayMap.Menu9BCD=MenuTubeDisplayTableHNCD[RunTime%10];					
//			break;
//		case 2 : 
//			MenuDisplay(1,0,"I-ROD ON   ");
//			Ht1621Date.DisplayMap.Menu10AFG=MenuTubeDisplayTableAIF[RunTime/10];
//			Ht1621Date.DisplayMap.Menu10BCD=MenuTubeDisplayTableHNCD[RunTime/10];
//				
//			Ht1621Date.DisplayMap.Menu11AFG=MenuTubeDisplayTableAIF[RunTime%10];
//			Ht1621Date.DisplayMap.Menu11BCD=MenuTubeDisplayTableHNCD[RunTime%10];					
//			break;
//	}
// }
// else MenuDisplay(0,0,"-I-ROD ON   ");
}
void VerCodeDiplay(u8 display_mode,u16 Code_0,u16 Code_1,u16 Code_2,u16 Code_3)//δʹ��
{
 if(display_mode)
 {
//  MenuDisplay(1,0,"---------- ");
//	 
//	Ht1621Date.DisplayMap.Menu4AFG=MenuTubeDisplayTableAIF[Code_0];
//	Ht1621Date.DisplayMap.Menu4BCD=MenuTubeDisplayTableHNCD[Code_0];

//	Ht1621Date.DisplayMap.Menu5AFG=MenuTubeDisplayTableAIF[Code_1];
//	Ht1621Date.DisplayMap.Menu5BCD=MenuTubeDisplayTableHNCD[Code_1];	 
//	 
//	Ht1621Date.DisplayMap.Menu6AFG=MenuTubeDisplayTableAIF[Code_2];
//	Ht1621Date.DisplayMap.Menu6BCD=MenuTubeDisplayTableHNCD[Code_2];
//	 
//	Ht1621Date.DisplayMap.Menu7AFG=MenuTubeDisplayTableAIF[Code_3];
//	Ht1621Date.DisplayMap.Menu7BCD=MenuTubeDisplayTableHNCD[Code_3];
// }
// else MenuDisplay(0,0,"---------- ");
 }
}
//Display_mode 0 not display
//Displya_mode 1 display
//version ����汾��
void Program_versionDisplay(u8 display_mode,u16 version)
{
  if(display_mode)
	{
		  MenuDisplay(1,0,"V           ");
	 	 	Ht1621Date.DisplayMap.Menu3AFG=MenuTubeDisplayTableAIF[version/100];
			Ht1621Date.DisplayMap.Menu3BCD=MenuTubeDisplayTableHNCD[version/100];	
					 
		  Ht1621Date.DisplayMap.Menu4AFG=MenuTubeDisplayTableAIF[version%100/10];
			Ht1621Date.DisplayMap.Menu4BCD=MenuTubeDisplayTableHNCD[version%100/10];	
					 
			Ht1621Date.DisplayMap.Menu5AFG=MenuTubeDisplayTableAIF[version%100%10];
		  Ht1621Date.DisplayMap.Menu5BCD=MenuTubeDisplayTableHNCD[version%100%10];
	}
	else MenuDisplay(0,0,"V           ");
}
//========================================================================
// Description: Turn off all displays
// Parameter: None
//========================================================================
void LCD_All_Off(void) 
{ 
	memset(Ht1621Date.DisplayMapTable,0x00,sizeof(Ht1621Date.DisplayMapTable));
//	Ht1622WrAllData(0,LcdOffTab,32);
} 
//========================================================================
// Description: Show all displays
// Parameter: None
//========================================================================
void LCD_All_On(void) 
{ 
	memset(Ht1621Date.DisplayMapTable,0xFF,sizeof(Ht1621Date.DisplayMapTable));
//	Ht1622WrAllData(0,LcdOnTab,32);
} 






